package com.wc.alorithm_blue_bridge._思维.Q3199;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
import java.util.HashMap;
import java.util.Map;

/**
 * @Author congge
 * @Date 2023/11/22 9:32
 * @description 小明的完美序列
 * https://www.lanqiao.cn/problems/3199/learning/?page=1&first_category_id=1
 */
public class Main {
    public static void main(String[] args) {
        Input sc = new Input();
        int n = sc.nextInt();
        /**
         * 存储每个数的个数
         */
        Map<Integer, Integer> map = new HashMap<>();
        while (n-- > 0) {
            int num = sc.nextInt();
            if (map.containsKey(num)) {
                map.put(num, map.get(num) + 1);
            } else {
                map.put(num, 1);
            }
        }
        int ans = 0;
        for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
            int k = entry.getKey();
            int v = entry.getValue();
            if (k > v) {
                ans += v;
            } else if (k < v) {
                ans += v - k;
            }
        }
        System.out.println(ans);
    }

    static class Input {
        StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

        public int nextInt() {
            try {
                in.nextToken();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return (int) in.nval;
        }
    }
}
